home *** CD-ROM | disk | FTP | other *** search
/ MacWorld Secrets (4th Edition) / Mac Secrets CD 4th Ed.toast / Apple Advanced Technologies / Apple Speech Technologies 1.5 / PlainTalk Developer Info / Speech Recognition Manager SDK / SR Sample Code / Speakable Items Example / Sources / Process & Finder Stuff / ProcessUtils.h < prev   
Text File  |  1991-11-25  |  3KB  |  86 lines

  1. /*****************************************************************************
  2.  *
  3.  *  ProcessUtils.h
  4.  *
  5.  *  DESCRIPTION
  6.  *        Interface to ProcessUtils.c.
  7.  *
  8.  *  AUTHOR:     Matt Pallakoff
  9.  * 
  10.  *  CREATED:     9-9-91
  11.  *
  12.  *****************************************************************************/
  13.  
  14. #include "PPCToolBox.h"
  15. #include "AppleEvents.h"
  16.  
  17. #define PROCESS_NOT_FOUND_ERR -2
  18.  
  19. /* PUFindLocalProcess gets the location and port info corresponding to the
  20.  *    process or application with the given signature.  If the process is already
  21.  *    running, the info is just returned.  Otherwise, if launchIfCan is true then
  22.  *    this routine tries to find the application with the given signature on
  23.  *    a locally mounted volume, and if it finds it then it launches it and returns
  24.  *    the information.  If the process can't be found then this routine returns
  25.  *    PROCESS_NOT_FOUND_ERR (i.e. -2).  If all goes well, 0 is returned.  Otherwise
  26.  *    a non-zero error code is returned.
  27.  */
  28. OSErr PUFindLocalProcess (OSType processSignature,
  29.                             Boolean launchIfCan,
  30.                             LocationNameRec *theLocation,
  31.                             PortInfoRec *thePortInfo);
  32.             
  33.                             
  34. /* PUSendAppleEventWith1Param sends an apple event with the given class and ID to the given location.
  35.  *    The direct parameter is set to the given data before sending.  This routine doesn't wait for
  36.  *    or return a reply (see PUSendAppleEventWith1ParamAndWait below).
  37.  */
  38. OSErr PUSendAppleEventWith1Param(LocationNameRec    *theLocation, 
  39.                             PortInfoRec        *thePortInfo, 
  40.                             AEEventClass    eventClass,
  41.                             AEEventID        eventID,
  42.                             DescType        dataType, 
  43.                             void            *dataPtr, 
  44.                             Size            dataSize);
  45.                     
  46.                             
  47. /* PUSendAppleEventWith2Params sends an appleevent with two parameters.  If sessionID is non-zero
  48.  *    then the sessionID is used to indicate the receiving process.  Otherwise if signature is non-zero
  49.  *    then the signature is used to indicate the receiving process.  Otherwise theLocation and
  50.  *    thePortInfo are used.  Also, if 'waitForReply' is true then this routine waits 'timeout' ticks
  51.  *    for the reply, and sets theReply to the reply AppleEvent if all goes well.  The calling routine
  52.  *    should dispose the reply AppleEvent (using AEDisposeDesc(theReply)) when done with it.
  53.  */
  54. OSErr PUSendAppleEventWith2Params(long            sessionID,        
  55.                             OSType            signature,
  56.                             LocationNameRec    *theLocation, 
  57.                             PortInfoRec        *thePortInfo, 
  58.                             AEEventClass    eventClass,
  59.                             AEEventID        eventID,
  60.                             AEKeyword        keyWord1,
  61.                             DescType        dataType1, 
  62.                             void            *dataPtr1, 
  63.                             Size            dataSize1,
  64.                             AEKeyword        keyWord2,
  65.                             DescType        dataType2, 
  66.                             void            *dataPtr2, 
  67.                             Size            dataSize2,
  68.                             Boolean            waitForReply,
  69.                             long            timeOut,
  70.                             AppleEvent        *theReply);
  71.  
  72. /* PUSendAppleEventWith1Param is the same as PUSendAppleEventWith1Param, except it waits for the
  73.  *    reply to the AppleEvent.  It waits timeout ticks before assuming the send failed.  If the
  74.  *    send succeeded, it sets theReply to point to the reply AppleEvent (which the calling routine
  75.  *    should dispose when done with it).
  76.  */
  77. OSErr PUSendAppleEventWith1ParamAndWait(LocationNameRec    *theLocation, 
  78.                             PortInfoRec        *thePortInfo, 
  79.                             AEEventClass    eventClass,
  80.                             AEEventID        eventID,
  81.                             DescType        dataType, 
  82.                             void            *dataPtr, 
  83.                             Size            dataSize,
  84.                             long            timeout,
  85.                             AppleEvent        *theReply);
  86.